<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String s=(String)request.getAttribute("cus_id");
if(s!=""){
	
}
%>
<!DOCTYPE>
<html>
  <head>
    <meta charset="utf-8">
    <link type="text/css" href="Style.css" rel="stylesheet"></link>
  	<title>我的订单</title>
	<style>
	  div#divOfMyOrder{position:absolute;left:150px;top:150px;}
	</style>
    <script type="text/javascript" src="js/inputnull.js"></script>
	<script type="text/javascript" src="js/jquery-3.5.1.js" ></script>
	<script type="text/javascript">
		<%
		out.print("<script>alert('为了显示第二个存在的无用框');</script>");
		//String admin_id=(String)request.getAttribute("admin_id");
		String cus_id=(String)request.getSession().getAttribute("cus_id");
		System.out.println(cus_id);
		out.print("<script>alert('"+cus_id+"');</script>");
		
		%>
	</script>
	<script>
	function clearBooksTable() {
		var table = document.getElementById("myOrd");
		while (table.rows.length > 1)
		table.deleteRow(1);
	}

	function show(){

		$.post("../findOrdersServlet",{cus_id:"c000002"},function(orders){
			 	clearBooksTable();
				var recycleList=JSON.parse(books);
				var table=document.getElementById("myOrd");
				for(var index in book){
					var newRow = table.insertRow(table.rows.length);
					var col1 = newRow.insertCell(0);
					var col2 = newRow.insertCell(1);
					var col3 = newRow.insertCell(2);
					var col4 = newRow.insertCell(3);
					col1.innerHTML = recycleList[index].recycle_id; 
					col2.innerHTML = recycleList[index].books;
					col3.innerHTML = recycleList[index].price;
					col4.innerHTML = recycleList[index].state;
				}
		})
	}
	
	</script>
  </head>
  <body onload="show()">
	<ul id="nav">        <!--导航条-->
	  <li><a href="myOrder.jsp">我的订单 </a></li>
	  <li><a href="recycle.html">申请回收 </a></li>
	  <li><a href="myInfo.html">个人信息 </a></li>
	  <li><a href="">常见问题 </a></li>
	  <li><a href="login.html">退出登录 </a></li>
	</ul>
	<form id="searchBook" onSubmit=" return navigationbeforeSubmit(this) ">
	    <text id="s_b_txt1">二手书回收平台</text>
	    <text id="s_b_txt2">二手书定价查询平台</text>
	    <input id="s_b_input1" name="bookNameAuthor" type="text" placeholder="图书名称、作者">
		<input id="s_b_input2" name="search" type="submit" value="搜索">                   <!-- 搜索功能 -->
	</form>
	<div id="divOfMyOrder">
		<h1>我的订单</h1>
	    <input type="button" value="全部订单">       <!-- 对以下表格进行操作 -->
		<input type="button" value="待回收">
		<input type="button" value="待确认">
		<input type="button" value="已完成">
		<input type="button" value="已退货">
		<input type="button" value="已取消">
        <table class="myOrd" id="myOrd">                     <!-- 显示回收单 -->       
          <tbody>
		    <tr>
			  <th>订单号</th><th>二手书</th><th>交易价格</th><th>订单状态</th>
			</tr>
			<tr>
			  <td>       </td><td>       </td><td>       </td><td>       </td>         <!-- 将回收单信息放到该表格中 -->  
			</tr>
		  </tbody>
        </table>		
	</div>
  </body>
</html>